// prettier.config.mjs

/** @type {import('stylelint').Config} */
const config = {
  extends: [
    'stylelint-config-recommended',
    'stylelint-config-recommended-scss',
    'stylelint-config-recommended-vue',
    'stylelint-config-recess-order'
  ],
  overrides: [
    // 扫描 .vue/html 文件中的<style>标签内的样式
    {
      files: ['**/*.{vue,html}'],
      customSyntax: 'postcss-html'
    },
    {
      files: ['**/*.{css,scss}'],
      customSyntax: 'postcss-scss'
    }
  ],
  rules: {
    'no-empty-source': null,
    // 处理不认识 rpx 问题
    'unit-no-unknown': [
      true,
      {
        ignoreUnits: ['rpx']
      }
    ],
    // 处理小程序page标签不认识的问题
    'selector-type-no-unknown': [
      true,
      {
        ignoreTypes: ['page']
      }
    ],
    // 允许 scss 常用 at-rule，防止误删 @import
    'at-rule-no-unknown': [
      true,
      {
        ignoreAtRules: [
          'import',
          'mixin',
          'include',
          'extend',
          'if',
          'else',
          'for',
          'each',
          'while',
          'function',
          'return',
          'use',
          'forward'
        ]
      }
    ],
    'scss/load-partial-extension': null
  }
};

export default config;
